package com.chenjl.api;

import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.List;

import org.apache.kafka.clients.Metadata;
import org.apache.kafka.common.Cluster;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 * Metadata
 * 由NetworkClient.DefaultMetadataUpdater 负责更元数据
 * 2016-9-18 15:25:54
 * @author chenjinlong
 */
public class TestOnMetadata {
	private static final Logger logger = LoggerFactory.getLogger(TestOnMetadata.class);
	
	public static void main(String[] args) {
		//刷新频率
		int retryBackoffMs = 100;
		//meta过期期限
		int metadataMaxAgeMs = 5*60*1000;
		
		Metadata metadata = new Metadata(retryBackoffMs,metadataMaxAgeMs);
		
		//更新
		List<InetSocketAddress> addresses = new ArrayList<InetSocketAddress>();
		addresses.add(new InetSocketAddress("192.168.245.129",9092));
		metadata.update(Cluster.bootstrap(addresses),System.currentTimeMillis());
		
		//外部更新
		//metadata.update(cluster,now);
	}
}